<template>
    <div class='orderSetting'>
        <el-dialog title="分销设置" visible @close="$emit('close')" width="800px" append-to-body :close-on-click-modal="false">
            <!-- <div class="container"> -->
            <el-header>团长升级大团长</el-header>
            <el-main>
                <div style="display: flex; align-items: flex-start; color: red;">升级条件：</div>
                <div style="display:flex; flex-direction:column; align-items: center;">
                    <el-form ref="form" :model="form" style="width: 80%;" :rules="rules" v-loading="formLoading">
                        <el-col :span="24">
                            <el-form-item label="拉新人数：" prop="dist_promote_recruits">
                                <el-col :span="10">
                                    <el-input v-model="form.dist_promote_recruits"
                                        @keyup.native="form.dist_promote_recruits = handleNum(form.dist_promote_recruits)"
                                        placeholder="请输入">
                                        <!-- <template slot="append">天</template> -->
                                    </el-input>
                                </el-col>
                            </el-form-item>
                        </el-col>
                        <span style="color: red;font-size: x-small;">或</span>
                        <el-col :span="24">
                            <el-form-item label="总营业额：" prop="dist_promote_turnover">
                                <el-col :span="10">
                                    <el-input v-model="form.dist_promote_turnover"
                                        @keyup.native="form.dist_promote_turnover = onInput(form.dist_promote_turnover)"
                                        placeholder="请输入">
                                        <!-- <template slot="append">天</template> -->
                                    </el-input>
                                </el-col>
                            </el-form-item>
                        </el-col>
                    </el-form>
                    <el-row style="margin-top: 40px;">
                        <el-col>
                            <el-button type="primary" @click="submit">提交</el-button>
                        </el-col>
                    </el-row>
                </div>
            </el-main>
        </el-dialog>
    </div>
</template>
<script>
import { setConfigsInfo, getConfigsInfo } from "@/api/basic/params.js"
import { yesNo } from "@/api/dictionary"
import throttle from 'lodash.throttle'
export default {
    name: 'withdraw',
    props: {

    },
    data() {
        const isMin = (rule, value, callback) => {
            if (value < this.least) {
                return callback(new Error('提现数额低于最小金额'))
            } else {
                callback()
            }
        }
        return {
            loading: false,
            handleShow: "",
            formLoading: false,
            form: {
            },
            least: '',
            yesNo: yesNo,
            rules: {
                // account_id: [{ required: true, message: '请选择提现账号', trigger: 'blur' }],
                // with_amount: [{ required: true, message: "请输入提现金额", trigger: "blur" }, {validator: isMin, trigger: 'blur'}],
            },
            accountList: [],
            // Info: {},
        }
    },

    created() {
        this.getConfigsInfo()
    },
    methods: {
        getConfigsInfo() {
            getConfigsInfo().then(res => {
                console.log(res, '000')
                this.form = res.data
            })
        },
        close() {
            this.$emit('close');
            this.form = {}
            this.handleShow = ""
        },
        submit: throttle(function () {
            this.$refs.form.validate((valid) => {
                if (valid) {
                    this.formLoading = true;
                    setConfigsInfo(this.form).then(res => {
                        this.msgSuccess("操作成功！");
                        this.close()
                        this.formLoading = false;
                    }).catch(() => {
                        this.formLoading = false;
                    })
                }
            })
        }, 1000, { trailing: false }),
    }
}
</script>

<style lang='scss' scoped>
.el-header {
    width: 99%;
    background-color: #F3F3F3;
    // color: #333;
    text-align: center;
    line-height: 60px;
}

.el-main {
    width: 99%;
    border: 1px solid #E4E4E4;
    text-align: center;
    line-height: 160px;
}

// /deep/.el-descriptions--mini.is-bordered .el-descriptions-item__cell {
//     padding: 0 10px;
// }

// /deep/.el-descriptions-item__cell {
//     padding: 0;
// }

// /deep/ .el-col {
//     margin: 0px;
//     padding: 0px;
//     height: 30px;
//     line-height: 30px;
// }</style>
